package com.atguigu.inherited;

//extends：扩展，继承
public class Student extends Person{//Student是Person的子类
    //这里故意先不私有化
    public int score;

    //子类的无参构造
    public Student(){
        super();//调用父类的无参构造。这句代码可以省略。
    }

    //子类的有参构造
    public Student(String name, int age, char gender, int score) {
        super(name, age, gender);//调用父类的有参构造
        this.score = score;
    }

    public void study(){
        System.out.println("学习");
    }

    public String getInfo(){
        return super.getInfo() + "，成绩：" + score;
       // return "姓名：" + name +"，年龄：" + age + "，性别 ：" + gender +"，成绩：" + score;
       // return "姓名：" + name +"，年龄：" + age + "，性别 ：" + getGender() +"，成绩：" + score;
    }
}
